<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of clearEquation</title>
  <meta name="keywords" content="clearEquation">
  <meta name="description" content="Clean a given set of equations from every repeated equation.">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html v1.5 &copy; 2003-2005 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../index.html">Home</a> &gt;  <a href="index.html">source</a> &gt; clearEquation.m</div>

<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for source&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>-->

<h1>clearEquation
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>Clean a given set of equations from every repeated equation.</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function [ clearedEquations ] = clearEquation( equations ) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment">Clean a given set of equations from every repeated equation.

Clean a given set of equations from every repeated equation. The function
checks one by one the given equations and create a new array with the same
information as the input but without repeated equations.

Prototype: [clearedEquations] = clearEquation( equations )

Input:     equations - An array that has a single equation for every
           cell. The equations are all equal to 0, and you only need to
           specify the left member of every single equation without &quot;= 0&quot;.

Output:    clearedEquations - An array that cointains the same information
           of the input, but without useless repeated equations.</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="generateSymsL.html" class="code" title="function [ L ] = generateSymsL( n, m, hState, d )">generateSymsL</a>	Generate the syms matrix L.</li></ul>
<!-- crossreference -->



<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <span class="comment">%Clean a given set of equations from every repeated equation.</span>
0002 <span class="comment">%</span>
0003 <span class="comment">%Clean a given set of equations from every repeated equation. The function</span>
0004 <span class="comment">%checks one by one the given equations and create a new array with the same</span>
0005 <span class="comment">%information as the input but without repeated equations.</span>
0006 <span class="comment">%</span>
0007 <span class="comment">%Prototype: [clearedEquations] = clearEquation( equations )</span>
0008 <span class="comment">%</span>
0009 <span class="comment">%Input:     equations - An array that has a single equation for every</span>
0010 <span class="comment">%           cell. The equations are all equal to 0, and you only need to</span>
0011 <span class="comment">%           specify the left member of every single equation without &quot;= 0&quot;.</span>
0012 <span class="comment">%</span>
0013 <span class="comment">%Output:    clearedEquations - An array that cointains the same information</span>
0014 <span class="comment">%           of the input, but without useless repeated equations.</span>
0015 
0016 <a name="_sub0" href="#_subfunctions" class="code">function [ clearedEquations ] = clearEquation( equations )</a>
0017 
0018 <span class="comment">%k is the current position in the output array. This index is used in order</span>
0019 <span class="comment">%to add further equations in the correct position in the output array.</span>
0020 k = 1;
0021 
0022 <span class="keyword">for</span> i = 1:length(equations)
0023     repeated = false;
0024     
0025     <span class="comment">%Check if the i-th equation is repeated in the next equations. Doing</span>
0026     <span class="comment">%so, the last occorrence of an equation is the right one for the output</span>
0027     <span class="comment">%array.</span>
0028     <span class="keyword">for</span> j = (i+1):length(equations)
0029         <span class="keyword">if</span> strcmp(char(equations(i)),char(equations(j)))
0030             repeated = true;
0031         <span class="keyword">end</span>
0032     <span class="keyword">end</span>
0033     
0034     <span class="comment">%If the i-th equation has no repetitions, it is added to the output</span>
0035     <span class="comment">%array at the k-th cell, and then k is increased by 1.</span>
0036     <span class="keyword">if</span> ~repeated
0037         clearedEquations(k) = equations(i);
0038         k = k + 1;
0039     <span class="keyword">end</span>
0040     
0041 <span class="keyword">end</span>
0042 
0043 <span class="keyword">return</span>;
0044 
0045 <span class="keyword">end</span></pre></div>
<hr><address>Generated on Mon 12-Oct-2009 21:15:56 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
</body>
</html>